Version 1/060801 of Furniture by Sir Gareth begins here.

Volume 1 -  Postures

Posture is a kind of value.  The postures are standing, sitting, and lying.

A person has a posture called current posture.  The current posture of a person is usually standing.

To say the posture status of (X - a person):
  If X is in a furniture (called Y), say "[current posture of X] [onprep of Y] [the Y]";
  otherwise if the current posture of X is not standing, say "[current posture of X] down".

Furniture is a kind of supporter.  Furniture is usually scenery.  Furniture is usually enterable.  Furniture is usually fixed in place.  Furniture has a property called onprep.  The onprep of furniture is usually "on".  Furniture has a posture called default posture.  The default posture is usually sitting.

Furniture can be multiple occupancy.  Furniture is usually multiple occupancy

Furniture can be sittable.  Furniture is usually sittable.  

Furniture can be standable.  Furniture is seldom standable.

Furniture can be liable.  Furniture is seldom liable.

A generic-chair is a kind of furniture.  A generic-chair is usually sittable.

A generic-bed is a kind of furniture.  A generic-bed is usually sittable.  A generic-bed is usually liable.

A generic-desk is a kind of furniture.  A generic-desk is usually sittable.  The onprep of a generic-desk is usually "at".

Volume 2 - Verbs


Section  A - Sitting

Sitting on is an action applying to one thing

Understand "sit on/in/at [furniture]" as sitting on

Instead of sitting on furniture that is not sittable, say "You can't sit on that."

Instead of someone trying sitting on something that is not sittable, stop the action

[A check entering rule:  Abide by the can't enter closed containers rule

A check entering rule:  Abide by the determine common ancestor for entering rule

A check entering rule:  Abide by the can't enter something carried rule

A check entering rule:  Abide by the implicitly pass through other barriers rule]

Check sitting on:  Abide by the check entering rules 

[Check sitting on:   If the player is in the noun and the current posture of the player is sitting, say "But you're already sitting on [the noun]!" instead ]

Check sitting on:  If someone (called occupant) is in the noun and the noun is not multiple occupancy, say "[The occupant] is already [onprep of the noun] [the noun]." instead

Check someone trying sitting on: Abide by the check entering rules 

[Check someone trying sitting on (this is the can't sit where already sitting rule):   If the player is in the noun and the current posture of the player is sitting, stop the action]

Check someone trying sitting on (this is the can't sit where someone else is sitting rule):  If someone is in the noun and the noun is not multiple occupancy, stop the action

Carry out sitting on:
  Consider the standard entering rule;
  Change the current posture of the player to sitting.

Report sitting on:
  Say "You sit down [onprep of the noun] [the noun]."

Carry out someone trying sitting on:
  Consider the standard entering rule;
  Change the current posture of the person asked to sitting.

Report someone trying sitting on:
  Say "[The person asked] sits [onprep of the noun] [the noun]."

Section B - Lying

Lying on is an action applying to one thing

Understand "lie on/in [something]" as lying on

Instead of lying on furniture that is not liable, say "You can't lie on that."

Instead of someone trying lying on something that is not liable, stop the action

Check lying on:  Abide by the check entering rules 

Check lying on:  If someone (called occupant) is in the noun and the noun is not multiple occupancy, say "[The occupant] is already [onprep of the noun] [the noun]." instead

Check someone trying lying on: Abide by the check entering rules 

Check someone trying lying on (this is the can't lie where someone else is lying rule):  If someone is in the noun and the noun is not multiple occupancy, stop the action

Carry out lying on:
  Consider the standard entering rule;
  Change the current posture of the player to lying.

Report lying on:
  Say "You lie down [onprep of the noun] [the noun]."

Carry out someone trying lying on:
  Consider the standard entering rule;
  Change the current posture of the person asked to lying.

Report someone trying lying on:
  Say "[The person asked] lies [onprep of the noun] [the noun]."

Section C - Standing

Standing on is an action applying to one thing

Understand "stand on/in/at [furniture]" as standing on

Instead of standing on furniture that is not standable, say "You can't stand on that."

Instead of someone trying standing on something that is not standable, stop the action

Check standing on:  Abide by the check entering rules 

Check standing on:  If someone (called occupant) is in the noun and the noun is not multiple occupancy, say "[The occupant] is already [onprep of the noun] [the noun]." instead

Check someone trying standing on: Abide by the check entering rules 

Check someone trying standing on (this is the can't stand where someone else is standing rule):  If someone is in the noun and the noun is not multiple occupancy, stop the action

Carry out standing on:
  Consider the standard entering rule;
  Change the current posture of the player to standing.

Report standing on:
  Say "You stand [onprep of the noun] [the noun]."

Carry out someone trying standing on:
  Consider the standard entering rule;
  Change the current posture of the person asked to standing.

Report someone trying standing on:
  Say "[The person asked] stands [onprep of the noun] [the noun]."

Section D - Entering

Instead of entering furniture when the default posture of the noun is sitting, try sitting on the noun instead.

Instead of entering furniture when the default posture of the noun is lying, try lying on the noun instead.

Instead of entering furniture when the default posture of the noun is standing, try standing on the noun instead.

Section E - Exiting

Carry out exiting:
  Change the current posture of the player to standing


Volume 3 - Descriptions

Section A - Room header

[Many thanks to Jesse McGrew, shstein2, and Moynus Frey for helpful advice and sample code for this section]

A procedural rule: substitute the new room heading rule for the room 
description heading rule. 

To decide which number is print player flag: (- (print_player_flag) -). 

This is the new room heading rule: 
   if the person asked is not the player, make no decision; 
   say "[bold type]"; 
   if in darkness, say "Darkness"; 
   otherwise say location; 
   say roman type; 
   if the holder of the player is not a room 
   begin; 
        begin the describing the player's stance activity; 
        if handling the describing the player's stance activity 
        begin; 
	    if the player is in a furniture (called sup) begin;
              say " ([current posture of the player] [onprep of sup] [the sup])";
            otherwise;
              if the player is on a supporter (called sup), say " (on [the sup])"; 
              otherwise if the player is in a container (called cont), say " (in 
[the cont])"; 
              end if;
            end if; 
        end the describing the player's stance activity; 
    end if; 
    if the print player flag is 1, say " (as [the player])"; 
    say "[paragraph break]". 

Describing the player's stance is an activity. 

[Rule for describing the player's stance when the player is on furniture: 
   say " ([the posture status of the player])"

To say the posture-appearance of (P - a person):
  Say "[The P] is standing here."]

A person is usually scenery

Definition: a person is NPC if it is not the player. 

Definition: something is accessible: 
  if it is inaccessible, decide no; 
  decide yes. 

After looking when a NPC person is accessible: 
  repeat with x running through accessible NPC persons begin; 
   if X is on furniture, say the on-furniture-description of X;
   otherwise say the initial appearance of x;
   say line break;
  end repeat. 

The initial appearance of a person is usually "[The item described] is here[if the item described is on a furniture], [current posture of the item described] [onprep of the holder of the item described] [the holder of the item described][end if]."

[The initial appearance of a person is usually "ERROR--Must define an initial appearance for every person. "]

To say the on-furniture-description of (X - a person):
   say "[The x] is here";
   If x is on furniture, say ", [the posture status of x]";
   say ".".

Furniture ends here.

---- DOCUMENTATION ----

Furniture is an extension designed to allow people to assume various postures on furniture, including sitting, lying down, and standing.

The extension creates a new type of property called posture, with three possible values:  sitting, lying, and standing.  A person has a new posture property, called current posture, which contains the person's current posture.

Furniture is a new kind that includes various types of furniture that people might want to sit or lie on, like chairs and beds.  The extension provides three default types of furniture:  generic-chair (a chair or anything else that can be sat upon); generic-bed (a beds, couch, or anything else that can be sat and lain upon); and generic-desk (a desk, table, or anything that someone can sit "at" rather than on).

Example:
	"Test" by Me

	Include Furniture by Sir Gareth
	
	Parlor is a room.  "The parlor contains a couch and a desk."

	The couch is a generic-bed in the Parlor.

	The stool is a generic-chair in the Parlor.  The stool is standable.  The stool is not scenery.  The stool is not fixed in place.  The stool is not multiple occupancy.

	The desk is a generic-desk in the Parlor. The desk is not multiple occupancy.

